Optimal. Leaf size=74 \[ \frac{2 a^2 \cos (c+d x)}{d}-\frac{a^2 \cot (c+d x)}{d}+\frac{a^2 \sin (c+d x) \cos (c+d x)}{2 d}-\frac{2 a^2 \tanh ^{-1}(\cos (c+d x))}{d}-\frac{a^2 x}{2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.102471, antiderivative size = 74, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 6, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.286, Rules used = {2709, 3770, 3767, 8, 2638, 2635} \[ \frac{2 a^2 \cos (c+d x)}{d}-\frac{a^2 \cot (c+d x)}{d}+\frac{a^2 \sin (c+d x) \cos (c+d x)}{2 d}-\frac{2 a^2 \tanh ^{-1}(\cos (c+d x))}{d}-\frac{a^2 x}{2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2709
Rule 3770
Rule 3767
Rule 8
Rule 2638
Rule 2635
Rubi steps
\begin{align*} \int \cot ^2(c+d x) (a+a \sin (c+d x))^2 \, dx &=\frac{\int \left (2 a^4 \csc (c+d x)+a^4 \csc ^2(c+d x)-2 a^4 \sin (c+d x)-a^4 \sin ^2(c+d x)\right ) \, dx}{a^2}\\ &=a^2 \int \csc ^2(c+d x) \, dx-a^2 \int \sin ^2(c+d x) \, dx+\left (2 a^2\right ) \int \csc (c+d x) \, dx-\left (2 a^2\right ) \int \sin (c+d x) \, dx\\ &=-\frac{2 a^2 \tanh ^{-1}(\cos (c+d x))}{d}+\frac{2 a^2 \cos (c+d x)}{d}+\frac{a^2 \cos (c+d x) \sin (c+d x)}{2 d}-\frac{1}{2} a^2 \int 1 \, dx-\frac{a^2 \operatorname{Subst}(\int 1 \, dx,x,\cot (c+d x))}{d}\\ &=-\frac{a^2 x}{2}-\frac{2 a^2 \tanh ^{-1}(\cos (c+d x))}{d}+\frac{2 a^2 \cos (c+d x)}{d}-\frac{a^2 \cot (c+d x)}{d}+\frac{a^2 \cos (c+d x) \sin (c+d x)}{2 d}\\ \end{align*}
Mathematica [A] time = 0.58033, size = 94, normalized size = 1.27 \[ -\frac{a^2 \csc \left (\frac{1}{2} (c+d x)\right ) \sec \left (\frac{1}{2} (c+d x)\right ) \left (7 \cos (c+d x)+\cos (3 (c+d x))+4 \sin (c+d x) \left (-4 \cos (c+d x)-4 \log \left (\sin \left (\frac{1}{2} (c+d x)\right )\right )+4 \log \left (\cos \left (\frac{1}{2} (c+d x)\right )\right )+c+d x\right )\right )}{16 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.036, size = 89, normalized size = 1.2 \begin{align*}{\frac{\cos \left ( dx+c \right ){a}^{2}\sin \left ( dx+c \right ) }{2\,d}}-{\frac{{a}^{2}x}{2}}-{\frac{{a}^{2}c}{2\,d}}+2\,{\frac{\cos \left ( dx+c \right ){a}^{2}}{d}}+2\,{\frac{{a}^{2}\ln \left ( \csc \left ( dx+c \right ) -\cot \left ( dx+c \right ) \right ) }{d}}-{\frac{{a}^{2}\cot \left ( dx+c \right ) }{d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.64023, size = 107, normalized size = 1.45 \begin{align*} \frac{{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} - 4 \,{\left (d x + c + \frac{1}{\tan \left (d x + c\right )}\right )} a^{2} + 4 \, a^{2}{\left (2 \, \cos \left (d x + c\right ) - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{4 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.52358, size = 281, normalized size = 3.8 \begin{align*} -\frac{a^{2} \cos \left (d x + c\right )^{3} + 2 \, a^{2} \log \left (\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right ) \sin \left (d x + c\right ) - 2 \, a^{2} \log \left (-\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right ) \sin \left (d x + c\right ) + a^{2} \cos \left (d x + c\right ) +{\left (a^{2} d x - 4 \, a^{2} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, d \sin \left (d x + c\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} a^{2} \left (\int 2 \sin{\left (c + d x \right )} \cot ^{2}{\left (c + d x \right )}\, dx + \int \sin ^{2}{\left (c + d x \right )} \cot ^{2}{\left (c + d x \right )}\, dx + \int \cot ^{2}{\left (c + d x \right )}\, dx\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.73197, size = 193, normalized size = 2.61 \begin{align*} -\frac{{\left (d x + c\right )} a^{2} - 4 \, a^{2} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) \right |}\right ) - a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + \frac{4 \, a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + a^{2}}{\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )} + \frac{2 \,{\left (a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 4 \, a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 4 \, a^{2}\right )}}{{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]